package com.zhang.controller;

import com.zhang.common.lang.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

//仅用于测试相关
@RestController
public class TestController {

    @Autowired
    BCryptPasswordEncoder bCryptPasswordEncoder;

    @GetMapping("/test")
    public String test(MultipartFile multipartFile){

        return "hello";
    }

    @GetMapping("/test/pass")   //获取11111加密后的密码
    public Result getPassword(){
        String password = bCryptPasswordEncoder.encode("11111");
        bCryptPasswordEncoder.matches("11111",password);    //是否匹配

        return Result.succ(password);
    }

}
